import axios from 'axios';

const baseUrl = import.meta.env.VITE_BASE_URL;
const service = axios.create({
  timeout: 30000,
  baseURL: baseUrl,
  headers: {
    'Content-Type': 'application/json;charset=UTF-8'
  }
});

// 请求拦截
service.interceptors.request.use((config) => {
  return config;
});
// 响应拦截
service.interceptors.response.use(
  (response) => {
    return response.data;
  },
  (error) => {
    const errMsg = error.Message || '';
    console.log(errMsg);
    return Promise.reject(error);
  }
);
export default service;
